
#IRQ Handlers
.global irq0
.global irq1
.global irq2
.global irq3
.global irq4
.global irq5
.global irq6
.global irq7
.global irq8
.global irq9
.global irq10
.global irq11
.global irq12
.global irq13
.global irq14
.global irq15

.extern irq_handler


irq0:
	cli
	push $0x0
	push $0x0
	jmp irq_stub_handler

irq1:
	cli
	push $0x0
	push $0x1
	jmp irq_stub_handler

irq2:
	cli
	push $0x0
	push $0x2
	jmp irq_stub_handler

irq3:
	cli
	push $0x0
	push $0x3
	jmp irq_stub_handler


irq4:
	cli
	push $0x0
	push $0x4
	jmp irq_stub_handler

irq5:
	cli
	push $0x0
	push $0x5
	jmp irq_stub_handler

irq6:
	cli
	push $0x0
	push $0x6
	jmp irq_stub_handler

irq7:
	cli
	push $0x0
	push $0x7
	jmp irq_stub_handler

irq8:
	cli
	push $0x0
	push $0x8
	jmp irq_stub_handler

irq9:
	cli
	push $0x0
	push $0x9
	jmp irq_stub_handler

irq10:
	cli
	push $0x0
	push $0xA
	jmp irq_stub_handler

irq11:
	cli
	push $0x0
	push $0xB
	jmp irq_stub_handler

irq12:
	cli
	push $0x0
	push $0xC
	jmp irq_stub_handler

irq13:
	cli
	push $0x0
	push $0xD
	jmp irq_stub_handler

irq14:
	cli
	push $0x0
	push $0xE
	jmp irq_stub_handler

irq15:
	cli
	push $0x0
	push $0xF
	jmp irq_stub_handler


irq_stub_handler:
	pusha
	push %ds
	push %es
	push %fs
	push %gs
	mov $0x10, %ax  # Load the Kernel Data Segment descriptor!
	mov %ax  , %ds
	mov %ax  , %es
	mov %ax  , %fs
	mov %ax  , %gs
	mov %esp, %eax
	push %eax
	mov $(irq_handler), %eax 
	call *%eax       # A special call, preserves the 'eip' register
	pop %eax
	pop %gs
	pop %fs
	pop %es
	pop %ds
	popa
	add $0x8, %esp
	iret
